# $Id: Makefile.in 596 2006-08-28 14:56:13Z mremond $

CC = @CC@
CFLAGS = @CFLAGS@ @SSL_CFLAGS@ @ERLANG_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ @SSL_LIBS@ @ERLANG_LIBS@

ifeq ($(shell uname),Darwin)
DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress
else
# Assume Linux-style dynamic library flags
DYNAMIC_LIB_CFLAGS = -fpic -shared
endif

SUBDIRS = 

ERLSHLIBS = ../tls_drv.so

OUTDIR = ..
EFLAGS = -I .. -pz ..
OBJS   = \
	$(OUTDIR)/tls.beam

all:    $(OBJS) $(ERLSHLIBS)

$(OUTDIR)/%.beam:       %.erl
	@ERLC@ -W $(EFLAGS) -o $(OUTDIR) $<

#all:	$(ERLSHLIBS)
#	erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt

$(ERLSHLIBS):	../%.so:	%.c
			$(CC) -Wall $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
			$(subst ../,,$(subst .so,.c,$@)) $(LIBS) \
			-o $@ -fpic $(DYNAMIC_LIB_CFLAGS)

clean:
	rm -f $(OBJS) $(ERLSHLIBS)

distclean: clean
	rm -f Makefile

TAGS:
	etags *.erl
